<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>while循环</title>
</head>
<body>
    <button onclick="funWhile()">点我一下</button>
    <button onclick="funSum()">100的和</button>
    <button onclick="funEven()">100内所有偶数的和</button>
    <button onclick="funContinue()">跳过周三</button>
    <button onclick="funBreak()">周三结束</button>
    <button onclick="funA()">1x9</button>
    <button onclick="funB()">乘法口诀表</button>
</body>
<script>
    function funWhile(){
        var i =1
        while (i<=20){
            console.log("第" + i + "圈")
            i++
        }
    }
    function funSum(){
        var i = 1
        sum = 0
        while (i<=100){
            sum += i
            i++
        }
        console.log(sum)
    }
    function funEven(){
        var i = 1
        sum = 0
        while (i<=100){
            if (i%2==0){
               sum += i
            }
            i++
        }
        console.log(sum)
    }
    function funContinue(){
        var i = 0
        while (i < 7){
            i++
            if(i==3){
                continue
            }
            console.log("今天周" + i)
        }
    }
    function funBreak(){
        var i = 0
        while (i<=7){
            if (i==3){
                break
            }
            console.log("今天周" + i)
            i++
        }
    }
    function funA(){
        var i = 1,j = 1
        while (j<=9){
            console.log(i + "*" + j + "=" + i*j)
            j++
        }
    }
    function funB() {
        var i = 1
        while (i<=9){
            var j = 1
            while (j<=i){
                document.write(i + "*" + j + "=" + i*j +"\t")
                j++
            }
            document.write("<br>")
            i++
        }
    }
</script>
</html>